package main

import (
	"fmt"
	"net/url"
)

func main() {
	test(1, 2, "foo")

	test1()
}

func test(args ...interface{}) {

	fmt.Println(args)
	fmt.Println(args[2])
}

func test1() {
	str := "foo bar %="
	res := url.PathEscape(str) //空格会被编码为%20，%会被编码为%25，=不会被编码为%3D
	fmt.Println(res)           //foo%20bar%20%25

	res1 := url.QueryEscape(str) //空格会被编码为+，%会被编码为%25，=会被编码为%3D
	fmt.Println(res1)            //foo+bar+%25

	p := url.Values{}
	p.Add("str", str)
	fmt.Println(p.Encode()) //str=foo+bar+%25%3D	//空格会被编码为+，%会被编码为%25，=会被编码为%3D

	str1 := "%3D"
	res2, _ := url.QueryUnescape(str1)
	fmt.Println(res2)

}
